<?php
	session_start();
	include 'base_config.php';	
	header($contentType_Javascript);
	header($cache);
	header($pragma);
	
	if (isset($_REQUEST['sessionid'])) {
		$session_id = $_REQUEST['sessionid'];
		$session_id =  mysql_real_escape_string($session_id);
		
		if ($session_id === session_id()) {
			$idBookmark = $_REQUEST['idBookmark'];
			$idBookmark =  mysql_real_escape_string($idBookmark);			
			
			$sql = "UPDATE `bookmark` SET `active` = 1 - `active` WHERE `idBookmark` = $idBookmark";
			$sql = mysql_real_escape_string($sql, $connect);
			
			if (mysql_query($sql)) {
				$tmp = "{\"Success\":\"true\"}";
				echo $tmp;
			} else {
				$tmp = "{\"Success\":\"false\"}";
				echo $tmp;
			}
			mysql_close($connect);
		} else {
			$tmp = "{\"Success\":\"NO_SESSION\"}";
			echo $tmp;
			session_unset();
			session_destroy();
		}
	}